package com.huiyun.project.im.core.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huiyun.project.im.entity.ImCsSessionConfig;
import com.huiyun.project.im.core.mapper.ImSessionConfigMapper;
import com.huiyun.project.im.core.service.IImSessionConfigService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 会话设置 服务实现类
 * </p>
 *
 * @author bogon
 * @since 2020-07-28
 */
@Service
public class ImSessionConfigServiceImpl extends ServiceImpl<ImSessionConfigMapper, ImCsSessionConfig> implements IImSessionConfigService {
    /**
     * 根据租户查询配置
     *
     * @param tenantId
     * @return
     */
    @Override
    public ImCsSessionConfig getByTenantId(String tenantId) {
        ImCsSessionConfig sessionConfig= this.getOne(Wrappers.query(new ImCsSessionConfig().setImTenantId(tenantId)));
        return  sessionConfig==null?new ImCsSessionConfig():sessionConfig;
    }
}
